﻿using System;
using System.ServiceModel;
using Bookvar.ObjectModel;
using Bookvar.ObjectModel.Actions.Collaboration;

namespace Bookvar.Collaboration.ServerSide
{
    public interface ICollaborationServiceCallback
    {
        [OperationContract(IsOneWay = true, Action = "http://tempuri.org/ICollaborationServiceCallback/UserEnter")]
        void UserEnter(CollaborationUser user);

        [OperationContract(AsyncPattern = true, IsOneWay = true,
            Action = "http://tempuri.org/ICollaborationServiceCallback/UserEnter")]
        IAsyncResult BeginUserEnter(CollaborationUser user, AsyncCallback callback, object asyncState);

        void EndUserEnter(IAsyncResult result);

        [OperationContract(IsOneWay = true, Action = "http://tempuri.org/ICollaborationServiceCallback/UserLeave")]
        void UserLeave(CollaborationUser user);

        [OperationContract(AsyncPattern = true, IsOneWay = true, 
            Action = "http://tempuri.org/ICollaborationServiceCallback/UserLeave")]
        IAsyncResult BeginUserLeave(CollaborationUser user, AsyncCallback callback, object asyncState);

        void EndUserLeave(IAsyncResult result);

        [OperationContract(IsOneWay = true, Action = "http://tempuri.org/ICollaborationServiceCallback/DoAction")]
        void DoAction(ActionBase action);

        [OperationContract(AsyncPattern = true, IsOneWay = true,
           Action = "http://tempuri.org/ICollaborationServiceCallback/DoAction")]
        IAsyncResult BeginDoAction(ActionBase action, AsyncCallback callback, object asyncState);

        void EndDoAction(IAsyncResult result);

        [OperationContract(IsOneWay = true, Action = "http://tempuri.org/ICollaborationServiceCallback/ServerClosed")]
        void ServerClosed(CollaborationUser host);

        [OperationContract(AsyncPattern = true, IsOneWay = true,
           Action = "http://tempuri.org/ICollaborationServiceCallback/ServerClosed")]
        IAsyncResult BeginServerClosed(CollaborationUser host, AsyncCallback callback, object asyncState);

        void EndServerClosed(IAsyncResult result);
    }
}